import React, {Component} from "react";
import {HashRouter, Switch, Route, Redirect} from 'react-router-dom'

// 异步加载路由
import asyncRouter from "@/utils/asyncRouter";
const Login = asyncRouter(() => import('@/pages/login/login'));
const Home = asyncRouter(() => import('@/pages/home/home'));
const Shop = asyncRouter(() => import('@/pages/shop/shop'));

export default class RouteConfig extends Component {
  render() {
    return (
      <HashRouter>
        <Switch>
          <Route path="/home" component={Home}/>
          <Route path="/shop/:id" component={Shop}/>
          <Route path="/login" component={Login}/>
          <Redirect exact from="/" to="login"/>
        </Switch>
      </HashRouter>
    )
  }
}